/**
 * This file is a part of qloudgen-sec. 
 * You can redistribute qloudgen-sec and/or modify it under the terms of the Lesser GNU General Public License version 3. 
 * qloudgen-sec is distributed WITHOUT ANY WARRANTY. 
 *
 * See the Lesser GNU General Public License for more details at http://www.gnu.org/licenses/. 
 **/
package org.qloudgen.sec.cas.client.session;

import java.io.Serializable;
import java.util.Enumeration;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionContext;

/**
 * <p>Title: Internal session wrapper</p>
 * <p>Description: Wrappered a virtual http session implementation.</p>
 * <p>Copyright: qloudgen/sec 2014</p>
 * @author <a href="mailto:hyq.dd.sun@gmail.com">glue.3M</a>
 *
 * 1.Unable to marshall object of type [org.eclipse.jetty.server.session.HashSessionManager$HashedSession]
 * 2.Unable to marshall object of type [org.apache.catalina.session.StandardSessionFacade]
 *
 */
public final class HttpSessionWrapper implements HttpSession , Serializable {
	/**
	 *
	 */
	private String id = null;
	
	/**
	 *
	 *
	 * @param id
	 */
	public HttpSessionWrapper(String id) {
		this.id = id;
	}
	
	/**
	 *
	 *
	 * @return id
	 */
	public String getId() {
		return id;
	}

	/**
	 * Returns the String representation.
	 *
	 * @return String
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append( "[" );
		builder.append( id );
		builder.append( ":" );
		builder.append( super.toString() );
		builder.append( "]" );
		//
		return builder.toString();
	}
	
	/**
	 * -----------------------------------------------------------------------
	 */
	public long getCreationTime() {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	public long getLastAccessedTime() {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	public ServletContext getServletContext() {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	public void setMaxInactiveInterval(int interval) {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	public int getMaxInactiveInterval() {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	public Object getAttribute(String name) {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	public Enumeration<String> getAttributeNames() {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	public void setAttribute(String name, Object value) {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	public void removeAttribute(String name) {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	public void invalidate() {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	public boolean isNew() {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	/**
	 * @deprecated
	 */
	@SuppressWarnings("dep-ann")
	public HttpSessionContext getSessionContext() {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	/**
	 * @deprecated
	 */
	@SuppressWarnings("dep-ann")
	public Object getValue(String name) {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	/**
	 * @deprecated
	 */
	@SuppressWarnings("dep-ann")
	public String[] getValueNames() {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	/**
	 * @deprecated
	 */
	@SuppressWarnings("dep-ann")
	public void putValue(String name, Object value) {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
	
	/**
	 * @deprecated
	 */
	@SuppressWarnings("dep-ann")
	public void removeValue(String name) {
		throw new RuntimeException( "Internal http session wrapper not support..." );
	}
}